package com.itlaobing.demo.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Classname Result
 * @Description TODO()
 * @Date 2020/11/14 0014 15:38
 * @Author by Administrator
 * @Version v1.0
 */
public class Result implements Serializable {

    // 标识  0 失败  1 成功
    private Integer code;

    // 信息
    private String msg;

    // 数据
    private Object data;

    public Result(int code,String msg,Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static Result ok(){
        return new Result(1, "success");
    }

    public static Result ok(String msg){
        return new Result(1, "success");
    }

    public static Result fail(){
        return new Result(0, "fail");
    }

    public static Result fail(String msg){
        return new Result(0, "fail");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
